package com.veeder.datacollection.util;

import java.io.File;

import com.veeder.datacollection.util.GlobalConstants.FilePrefix;

public  class FileUtil {
	public static Boolean checkExist(String folderPath,FilePrefix prefix) { 
		File folder = new File(folderPath);
		if (!folder.exists() || !folder.isDirectory()) {
			return false;
		}

		for (File f : folder.listFiles()) {
			String name = f.getName();			
			if (name.startsWith(prefix.toString())
					&& (name.endsWith(GlobalConstants.BackupFilePostfix) || name
							.endsWith(GlobalConstants.OldFilePostfix)|| name
							.endsWith(GlobalConstants.DefaultFileSuffix))) {
				return true;
			}
		}

		return false;

	}
}
